<div id="close" align="right"></div>
<div id="fly_done">
	<input id="btn_fly_done" done-value="{fly_done_value}" class="btn_div"
		type="button" value="{fly_done_label}" />
</div>
<div
	style="margin-top: 10px; padding-left: 5px; font-size: 11px; color: #0099d3; font-weight: bold">{fly_name_and_time}</div>
<div
	style="margin-top: 10px; padding-left: 5px; font-size: 11px; color: #0099d3; font-weight: bold">{plane}</div>
<div
	style="width: 96%; height: 1px; padding: 5px; border-bottom: 1pxsolid #CCC"></div>
<!--popup.append(getEmployees(request, response));-->
{employee_list}
<div
	style="margin-top: 10px; padding: 5px; font-size: 11px; color: #0099d3;">Үйлчлэгч
	нэмэх</div>
<div style="padding: 5px">
	<select id="allemployees" style="width: 220px">
		<!--popup.append(getAvailableEmployeeList(fly, getSession()));-->
		{available_employee_list}
	</select> <input id="add" flyid="{fly_id}" class="btn" type="button"
		value="Нэмэх" />
</div>
<div
	style="width: 96%; height: 50%; padding: 5px; border: 1px solid #CCC">
	<input type="hidden" name="flyid" value="{fly_id}" />
	<div
		style="margin-top: 10px; padding: 5px; font-size: 11px; color: #0099d3;">Маяг</div>
	<div style="padding: 5px">
		<select style="width: 100%" id="dialog_fly_stay_type">
			{fly_stay_type_list}
		</select>
	</div>
	<div
		style="margin-top: 10px; padding: 5px; font-size: 11px; color: #0099d3;">Хугацаа</div>
	<div>
		<span style="padding: 5px; font-size: 11px; color: #333;">From</span>
		<input style="width: 70px;" type="text"
			value="{dialog_fly_stay_start_date}" id="dialog_fly_stay_start_date" />
		<input style="width: 35px;" type="text"
			value="{dialog_fly_stay_start_time}" id="dialog_fly_stay_start_time" />
		<br> <span style="padding: 5px; font-size: 11px; color: #333;">To&nbsp&nbsp&nbsp&nbsp</span>
		<input style="width: 70px;" type="text"
			value="{dialog_fly_stay_end_date}" id="dialog_fly_stay_end_date" />
		<input style="width: 35px;" type="text"
			value="{dialog_fly_stay_end_time}" id="dialog_fly_stay_end_time" />
	</div>
	<div
		style="margin-top: 10px; padding: 5px; font-size: 11px; color: #0099d3;">Байршил</div>
	<div style="padding: 5px">
		<select style="width: 100%" id="dialog_fly_stay_location">
			{fly_stay_location_list}
		</select>
	</div>

	<div
		style="margin-top: 10px; padding: 5px; font-size: 11px; color: #0099d3;">Тэмдэглэл</div>
	<div style="padding: 5px">
		<textarea style="width: 100%" rows="3" id="dialog_fly_stay_comment">{fly_stay_comment}</textarea>
	</div>

	<div style="width: 100%; margin-top: 15px;" align="right">
		<input id="btn_save_fly_stay" class="btn_div" type="button"
			value="Хадгалах" />
	</div>
</div>
<script>
	$(function() {
		$("#dialog_fly_stay_start_date").datepicker({
			dateFormat: 'yy/mm/dd'
		});
		$("#dialog_fly_stay_start_time").timepicker();
		$("#dialog_fly_stay_end_date").datepicker({
			dateFormat: 'yy/mm/dd'
		});
		$("#dialog_fly_stay_end_time").timepicker();
		$("#btn_save_fly_stay").live('click',function(){
			var flyid = $("[name=flyid]").val();
			var type = $("#dialog_fly_stay_type").val();
			var start_date = $("#dialog_fly_stay_start_date").val();
			var start_time = $("#dialog_fly_stay_start_time").val();
			var end_date = $("#dialog_fly_stay_end_date").val();
			var end_time = $("#dialog_fly_stay_end_time").val();
			var location = $("#dialog_fly_stay_location").val();
			var comment = $("#dialog_fly_stay_comment").val();
			
			var data =	"&flyid=" 		+ flyid + 
						"&type=" 		+ type + 
						"&start_date=" 	+ start_date + " "+ start_time +
						"&end_date=" 	+ end_date + " " + end_time +
						"&location=" 	+ location +
						"&comment=" 	+ comment;
			$.ajax({
				type : "GET",
				url : "main",
				data : "action=saveFlyStay" + data,
				success: function(response){
					alert(response);
				}
			});
		});
		$("#btn_fly_done").live('click',function(){
			var flyid = $("[name=flyid]").val();
			var done = $(this).attr('done-value');
			var data =	"&flyid=" + flyid +
						"&done=" + done;
			
			$.ajax({
				type : "GET",
				url : "main",
				data : "action=doneFly" + data,
				success: function(response){
					$("#fly_done").html(response);
				}
			});
		});
	});
</script>